
exports.init = init;
exports.insert = set;
exports.select = get;

var sqlite3 = require("sqlite3").verbose();
var fs = require("fs");

var file = "data/db_cdfgj.db";
const db = new sqlite3.Database(file);
init();

function init(){
   db.run("CREATE TABLE IF NOT EXISTS notes " +
        "(author VARCHAR(255), note TEXT)",
        function(err){
            if (err){
                // util.log('FAIL on creating table ' + err);
                callback(err);
            } else {
                callback(null);
            }
        });
}

function set() {
    db.run("insert into notes (author,note) values('aaa','ddd')");
    console.log('insert');
}

function get(){
    cc = db.run("select * from notes");
    console.log(cc);
}
